import request from '@/utils/request'
// 查询树形列表
export function listTree(query) {
  return request({
    url: '/admin/table/tree/',
    method: 'get',
    params: query
  })
}

// 查询表
export function listTable(query) {
  return request({
    url: '/admin/table/table/',
    method: 'get',
    params: query
  })
}

// 新增表
export function addTable(data) {
  return request({
    url: '/admin/table/table/',
    method: 'post',
    data: data
  })
}

// 修改表
export function updateTable(id,query) {
  return request({
    url: '/admin/table/table/' + id + '/',
    method: 'put',
    data:query
  })
}


// 删除表
export function delTable(tableName) {
  return request({
    url: '/admin/table/table/' + tableName + '/',
    method: 'delete'
  })
}

//新增字段
export function addField(data) {
    return request({
      url: `admin/table/field/`,
      method: 'post',
      data
    })
}

// 查询字段
export function listField(query) {
    return request({
      url:'admin/table/field/',
      method: 'get',
      params: query
    })
  }
//删除字段
export function delField(id) {
    return request({
      url: `admin/table/field/${id}/`,
      method: 'delete',
    })
}
//导入导出
export function xlsMould(id) {
  return request({
    url: `admin/data/xls/`,
    method: 'get',
  })
}